//
//  ModelType.swift
//  WanAndroidLearn
//
//  Created by TRS-Mobile on 2023/11/1.
//

import Then
import SmartCodable

protocol ModelType: SmartCodable, Then {
    associatedtype Event
    static var dateDecodingStrategy: JSONDecoder.DateDecodingStrategy { get }
}

extension ModelType {
    static var dateDecodingStrategy: JSONDecoder.DateDecodingStrategy { .iso8601 }
    
    static var decoder: JSONDecoder {
        let decoder = JSONDecoder()
        decoder.dateDecodingStrategy = self.dateDecodingStrategy
        return decoder
    }
}
